package com.ambientrs.bot;

import com.ambientrs.bot.gui.Gui;
import com.ambientrs.bot.io.ErrorPrinter;
import com.ambientrs.bot.io.IOManager;
import com.ambientrs.bot.io.Logger;
import com.ambientrs.script.methods.Methods;

import java.io.File;

public class Boot {

    public static Gui gui;


    public static void main(String[] args) {
        if (!new File(IOManager.log).exists())
            new File(IOManager.log).mkdir();
        if (!new File(IOManager.cache).exists())
            new File(IOManager.cache).mkdir();
        gui = new Gui();
        gui.setVisible(true);
        try {
            System.setErr(new ErrorPrinter(Logger.file));
            gui.appendToLog("Welcome to AmbientRS!", false);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Methods.log("lolol");
        Methods.log("lololololol");
        Methods.log("lolol");
        Methods.log("nicenicelolol");
        Methods.log("lolol");
        try {
            throw new Exception("this is a demo of how exceptions will look");
        } catch (Exception e) {
            e.printStackTrace();
        }
        Methods.log("lololololol");
        Methods.log("lolol");
        Methods.log("lololololol");
        gui.init();
    }

}
